<template>
	<el-container>
		<el-main class="nopadding">
			<scTable ref="table" :apiObj="apiObj" row-key="supervisionId" stripe remoteSort remoteFilter>
				<el-table-column label="#" type="index" width="50"></el-table-column>
				<el-table-column label="督查督办标题" prop="title" width="300" :show-overflow-tooltip="true"></el-table-column>
				<el-table-column label="事件类型" prop="typeName" width="150" :show-overflow-tooltip="true"></el-table-column>
				<el-table-column label="督查领导" prop="leadUserName" width="100"></el-table-column>
				<el-table-column label="牵头人" prop="handedUserName" width="100"></el-table-column>
				<el-table-column label="扣分" prop="sysScore" width="150">
					<template #default="scope">
						{{scope.row.sysScore}}/分
					</template>
				</el-table-column>
				<el-table-column label="领导评分" prop="userScore" width="150">
					<template #default="scope">
						{{(supervisionIntegral.userWeight / supervisionIntegral.totalPoints) * scope.row.userScore}}/分
					</template>
				</el-table-column>
				<el-table-column label="总得分" prop="finishTime" width="150">
					<template #default="scope">
						{{ (supervisionIntegral.sysWeight/ supervisionIntegral.totalPoints)* scope.row.sysScore+(supervisionIntegral.userWeight / supervisionIntegral.totalPoints) * scope.row.userScore}}/分
					</template>
				</el-table-column>
				<el-table-column label="操作" fixed="right" align="right" width="250">
					<template #default="scope">
						<el-button-group>
							<el-button text type="primary" size="small" @click="table_show(scope.row, scope.$index)">查看</el-button>
						</el-button-group>
					</template>
				</el-table-column>
			</scTable>
		</el-main>
	</el-container>
	<recordDetails v-if="dialog.detailsSave" ref="recordDialog" @closed="dialog.detailsSave=false"></recordDetails>
</template>

<script>
import recordDetails from "@/views/supervision/enter/details";
export default {
	name: 'Analysis Score Totals',
	components: {
		recordDetails
	},
	data() {
		return {
			supervisionIntegral:{},
			dialog: {
				detailsSave: false,
			},
			apiObj: this.$API.supervision.supervisionScore.getSupervisionScoreList,
		}
	},
	mounted() {
		this.getSupervisionIntegral();
	},
	methods: {
		table_show(row) {
			this.dialog.detailsSave = true
			this.$nextTick(() => {
				this.$refs.recordDialog.open().setData(row)
			})
		},
		async getSupervisionIntegral(){
			let res = await this.$API.supervision.supervisionIntegral.getSupervisionIntegral.get();
			if (res.code == 200) {
				this.supervisionIntegral = res.data;
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		}
	}
}
</script>

<style>
</style>
